Skip to main content

Github Release

Description

This plugin enables the ability to manage GitHub releases GitHub CLI in a Vela pipeline.

Source Code: https://github.com/go-vela/vela-github-release

Registry: https://hub.docker.com/r/target/vela-github-release

Usage

NOTE:

Users should refrain from using latest as the tag for the Docker image.

It is recommended to use a semantically versioned tag instead.

Sample of creating a GitHub release:

steps:
- name: gh
image: target/vela-github-release:latest
pull: always
parameters:
action: create
files: [ gh/common, gh/dev/deploy.yml ]
tag: v0.1.0

Sample of creating a GitHub release, attaching all .pdf files in the current directory:

steps:
- name: gh
image: target/vela-github-release:latest
pull: always
parameters:
action: create
files: [ "*.pdf" ]
tag: v0.1.0

[!IMPORTANT] This uses Go's implementation of glob patterns

Sample of deleting release files:

steps:
- name: gh
image: target/vela-github-release:latest
pull: always
parameters:
action: delete
tag: v0.1.0

Sample of downloading assets from a release in a project:

steps:
- name: gh
image: target/vela-github-release:latest
pull: always
parameters:
action: download
tag: v0.1.0

Sample of listing releases in a repository:

steps:
- name: gh
image: target/vela-github-release:latest
pull: always
parameters:
action: list

Sample of uploading assets to a gh release:

steps:
- name: gh
image: target/vela-github-release:latest
pull: always
parameters:
action: upload
files: [ changelog.md ]
tag: v0.1.0

Sample of uploading assets using glob pattern to a gh release:

steps:
- name: gh
image: target/vela-github-release:latest
pull: always
parameters:
action: upload
files: [ "*.pdf" ]
tag: v0.1.0

[!IMPORTANT] This uses Go's implementation of glob patterns

Sample of viewing information about a gh release:

steps:
- name: gh
image: target/vela-github-release:latest
pull: always
parameters:
action: view
tag: v0.1.0

Secrets

NOTE: Users should refrain from configuring sensitive information in your pipeline in plain text.

Internal

The plugin accepts the following parameters for authentication:

ParameterEnvironment Variable Configuration
tokenPARAMETER_TOKEN, CONFIG_TOKEN, GH_TOKEN, GITHUB_TOKEN

Users can use Vela internal secrets to substitute these sensitive values at runtime:

steps:
- name: gh
image: target/vela-github-release:latest
pull: always
+ secrets: [github_token]
parameters:
action: create
files: [ gh/common, gh/dev/deploy.yml ]

This example will add the secrets to the gh step as environment variables:

  • GITHUB_TOKEN=<value>

External

The plugin accepts the following files for authentication:

ParameterVolume Configuration
token/vela/parameters/github-release/config/token, /vela/secrets/github-release/config/token

Users can use Vela external secrets to substitute these sensitive values at runtime:

steps:
- name: gh
image: target/vela-github-release:latest
pull: always
+ secrets: [github_token]
parameters:
config:
- github_token: somepersonalaccesstoken

This example will read the secret value in the volume stored at /vela/secrets/

Parameters

NOTE:

The plugin supports reading all parameters via environment variables or files.

VELA environments can be found at VELA Environments

Any values set from a file take precedence over values set from the environment.

The following parameters are used to configure the image:

NameDescriptionRequiredDefaultEnvironment Variables
actionaction to perform against ghtrueN/APARAMETER_ACTION
CONFIG_ACTION
hostnamehostname to set for GitHub instancetruegithub.comPARAMETER_HOSTNAME
GH_HOST
GITHUB_HOST
tokentoken to set to authenticate to GitHub instancetrueN/APARAMETER_TOKEN
CONFIG_TOKEN
GH_TOKEN
GITHUB_TOKEN
log_levelset the log level for the plugintrueinfoPARAMETER_LOG_LEVEL
VELA_LOG_LEVEL
GITHUB_RELEASE_LOG_LEVEL
versionversion of the gh CLI to installfalsev2.14.4PARAMETER_VERSION
VELA_GH_VERSION
GH_VERSION

Create

The following parameters are used to configure the create action:

NameDescriptionRequiredDefaultEnvironment Variables
draftsave the release as a draft instead of publishing itfalsefalsePARAMETER_DRAFT
CREATE_DRAFT
notescreate release notesfalseN/APARAMETER_NOTES
CREATE_NOTES
notes_fileread release notes from filefalseN/APARAMETER_NOTES_FILE
CREATE_NOTES_FILE
filesfile(s) name used to createfalseN/APARAMETER_FILES
GITHUB_RELEASE_FILES
prereleasemark the release as a prereleasefalsefalsePARAMETER_PRERELEASE
CREATE_PRERELEASE
taggithub tag name to createtrueN/APARAMETER_TAG
GITHUB_RELEASE_TAG
targettarget branch or commit SHAtruemainPARAMETER_TARGET
CREATE_TARGET
titleRelease titlefalseN/APARAMETER_TITLE
CREATE_TITLE

Delete

The following parameters are used to configure the delete action:

NameDescriptionRequiredDefaultEnvironment Variables
yesskip the delete confirmation promptfalsefalsePARAMETER_YES
DELETE_YES
taggithub tag name to deletetrueN/APARAMETER_TAG
GITHUB_RELEASE_TAG

Download

The following parameters are used to configure the download action:

NameDescriptionRequiredDefaultEnvironment Variables
directorythe directory to download filestrue"."PARAMETER_DIR
DOWNLOAD_DIR
patternsdownload only assets that match glob patternsfalseN/APARAMETER_PATTERNS
DOWNLOAD_PATTERNS
taggithub tag name to downloadtrueN/APARAMETER_TAG
GITHUB_RELEASE_TAG

List

The following parameters are used to configure the list action:

NameDescriptionRequiredDefaultEnvironment Variables
limitmaximum number of items to fetch for list actiontrue30PARAMETER_LIMIT
LIST_LIMIT

Upload

The following parameters are used to configure the upload action:

NameDescriptionRequiredDefaultEnvironment Variables
clobberoverwrite existing assets of the same namefalsefalsePARAMETER_CLOBBER
UPLOAD_CLOBBER
filesfile(s) name used to uploadtrueN/APARAMETER_FILES
GITHUB_RELEASE_FILES
taggithub tag name to uploadtrueN/APARAMETER_TAG
GITHUB_RELEASE_TAG

View

The following parameters are used to configure the view action:

NameDescriptionRequiredDefaultEnvironment Variables
taggithub tag name to viewtrueN/APARAMETER_TAG
GITHUB_RELEASE_TAG
webopen the release in the browsertruefalsePARAMETER_WEB
VIEW_WEB

Troubleshooting

You can start troubleshooting this plugin by tuning the level of logs being displayed:

steps:
- name: github-release
image: target/vela-github-release:latest
pull: always
parameters:
action: create
files: [ gh/common, gh/dev/deploy.yml ]
+ log_level: trace